/**
 * @description 抽离编辑器的通用配置
 */

import { computed } from "vue"
import { pick } from "lodash-es"
import {TextComponentProps} from '../defaultProps'
const useComponentCommon = (props: Readonly<Partial<TextComponentProps>>, picks: string[]) => {
  const styleProps = computed(() => pick(props, picks))
  //触发点击方法 
  const hondelClick = () => {
    //如果存在跳转触发的方法
    if (props.actionType === 'url' && props.url) {
      window.location.href = props.url
    }
  }
  return {
    styleProps,
    hondelClick
  }
}
export default useComponentCommon